﻿@using DevFramework.Core.Web.Enums
@{
    //success messages
    var successMessages = new List<string>();

    if (TempData[string.Format("devframework.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.Add(TempData[string.Format("devframework.notifications.{0}", NotifyType.Success)].ToString());
    }

    if (ViewData[string.Format("devframework.notifications.{0}", NotifyType.Success)] != null)
    {
        successMessages.Add(ViewData[string.Format("devframework.notifications.{0}", NotifyType.Success)].ToString());
    }

    //error messages
    var errorMessages = new List<string>();

    if (TempData[string.Format("devframework.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.Add(TempData[string.Format("devframework.notifications.{0}", NotifyType.Error)].ToString());
    }

    if (ViewData[string.Format("devframework.notifications.{0}", NotifyType.Error)] != null)
    {
        errorMessages.Add(ViewData[string.Format("devframework.notifications.{0}", NotifyType.Error)].ToString());
    }
}

@foreach (var message in successMessages)
{
    <script type="text/javascript">

        $(document).ready(function () {
            displayPopupNotification('@Html.Raw(HttpUtility.JavaScriptStringEncode(message))', 'success');
        });

    </script>
}
@foreach (var message in errorMessages)
{
    <script type="text/javascript">

        $(document).ready(function () {
            displayPopupNotification('@Html.Raw(HttpUtility.JavaScriptStringEncode(message))', 'error');
        });

    </script>
}
<style>
    #dialog-notifications-success, #dialog-notifications-danger {
        position: fixed;
        right: 0;
        left: 0;
        margin-right: auto;
        margin-left: auto;
        width: 50%;
        z-index: 1510 !important;
        display: none;
    }
</style>

<div id="dialog-notifications-success" class="alert alert-success">
    <a class="close" onclick="$('#dialog-notifications-success').hide()">×</a>
    <span class="mesaj"></span>
</div>

<div id="dialog-notifications-danger" class="alert alert-danger">
    <a class="close" onclick="$('#dialog-notifications-danger').hide()">×</a>
    <span class="mesaj"></span>
</div>


<div id="myModalSuccess" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">İşlem Başarılı</h4>
            </div>
            <div class="modal-body">

            </div>
            @*<div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Kapat</button>
                </div>*@
        </div>
    </div>
</div>


